<?php
class CmsPhotoListControl extends GridControl
{
    protected $jsClass = 'CmsPhotoListControl';

    public function CmsPhotoListControl($viewName = null)
    {
        RequestHandler::Set('limit', 25);
        parent::__construct($viewName);

        GridConfig::GetInstance()->AddSharedJs('GridControl, GridSelectControl');
        CmsConfig::GetInstance()->AddSharedJs('CmsPhotoListControl');
    }

    public function GetConfig()
    {
       return CmsConfig::GetInstance();
    }

    public function FormatRow($item)
    {
        $item = parent::FormatRow($item);
        $photo = $item['id'];
        $item['url_thumb'] = Photo::GetInstance()->GetThumbUrl($photo);
        $default = array_get($this->params, 'defaultPhoto');
        $item['default'] =  $default == $photo ? 'default' : null;
        return $item;
    }
}
?>
